package com.atguigu.gulimall.product.service;

import com.atguigu.common.utils.PageUtils;
import com.atguigu.gulimall.product.entity.CategoryEntity;
import com.atguigu.gulimall.product.entity.vo.Catelog2Vo;
import com.baomidou.mybatisplus.extension.service.IService;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;

/**
 * 商品三级分类
 *
 * @author huguangwei
 * @email huguangwei@gmail.com
 * @date 2022-10-07 20:12:12
 */
public interface CategoryService extends IService<CategoryEntity> {

    PageUtils queryPage(Map<String, Object> params);

    List<CategoryEntity> listWithTree();

    Long[] findCatelogPath(Long catelogId);

    /**
     * 级联更新分类信息
     *
     * @param category
     */
    @Transactional
    void updateDetail(CategoryEntity category) throws RuntimeException;

    /**
     * 首页查询一级分类
     *
     * @return
     */
    List<CategoryEntity> getLevel1Categorys();

    Map<String, List<Catelog2Vo>> getCatelogJson();

    /**
     * 保存分类
     *
     * @param category
     */
    void saveCategory(CategoryEntity category);

    /**
     * 批量删除分类
     *
     * @param asList
     */
    void removeCategoryByIds(List<Long> asList);
}

